export tag=v1

# zhaoxiaobiao.cn:5000 是本机自建的 repo
build:
	echo "building httpserver container"
	docker build -t zhaoxiaobiao.cn:5000/gobin/httpserver:${tag} .

push: build
	echo "pushing zhaoxiaobiao.cn:5000/gobin/httpserver"
	docker push zhaoxiaobiao.cn:5000/gobin/httpserver:${tag}

run_test: push
	echo "running httpserver container"
	docker stop httpserver
	docker rm httpserver
	docker run -d -p18080:8080 --name httpserver zhaoxiaobiao.cn:5000/gobin/httpserver:${tag}

local_ip: run_test
	nsenter -t `docker inspect -f "{{.State.Pid}}" httpserver` -n ip a